package view

import (
	"html/template"
	"io"
	"imooc.com/crawler/frontend/model"
)

type SearchResult struct {
	template *template.Template //SearchResult继承模板
}

/**
展示视图
 */
func (s SearchResult) Render (
	w io.Writer, data model.SearchResult) error {
	return s.template.Execute(w, data)
}

func CreateSearchResultView(filename string) SearchResult  {
	return SearchResult{
		template: template.Must(template.ParseFiles(filename)),
	}
}